Repository navigation
feat(mcp): replace the reference number tools with update_record - #511
Conversation
One update_record tool in the default operations toolset replaces add_reference_numbers and remove_reference_numbers. It adds and removes reference numbers on containers, shipments and tracking requests, and tags on shipments. Like set_party_role and set_custom_field, a call that only adds writes at once, and a call that removes anything asks first. The opt-in reference_numbers toolset is gone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Automations to automatically generate PRs for you. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Shadow risk calibration
Calibration result: agreement. Shadow risk never blocks or enables merge. Keep it in observation mode until roughly 50 pull requests have human-reviewed labels, then calibrate before considering any policy use. |
| concurrent_change_detected: false, | ||
| }); | ||
| expect(updateRecordOutputSchema.parse(result)).toEqual(result); |
There was a problem hiding this comment.
Read-back failure tests were dropped
The replacement tests cover only a successful read-back. The deleted tests also checked a changed list, a failed second GET, and an unreadable second response. Restore those cases for update_record, including shipment tags. They protect the distinction between concurrent_change_detected: true and an unknown result with read_back_note, so future changes cannot silently report the wrong result after a successful write.
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/mcp/src/tools/update-record.test.ts
Line: 98-100
Comment:
**Read-back failure tests were dropped**
The replacement tests cover only a successful read-back. The deleted tests also checked a changed list, a failed second GET, and an unreadable second response. Restore those cases for `update_record`, including shipment `tags`. They protect the distinction between `concurrent_change_detected: true` and an unknown result with `read_back_note`, so future changes cannot silently report the wrong result after a successful write.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Why
Akshay asked in Project AI why reference numbers got their own add and remove tools instead of a patch tool. We had ported #452's shape as-is. One record-update tool is the better design: it matches
set_party_roleandset_custom_field, and it cuts the tool count.What changes
update_recordreplacesadd_reference_numbersandremove_reference_numbers(feat(mcp): add opt-in reference number tools #510). Those were opt-in and never served in production.entity_type+entity_id, thenref_numbers: { add, remove }(containers, shipments, tracking requests) andtags: { add, remove }(shipments only).confirms: "destructive_only". A call that only adds writes at once. A call that removes anything returns a preview and needs approval, through elicitation or a token. This is the same kit pathset_party_roleuses.concurrent_change_detectedand the unreadable-list guard carry over from feat(mcp): add opt-in reference number tools #510.operationstoolset, so production serves it on deploy without an env change. Thereference_numberstoolset is removed.update_recordadded in the developer portal.Testing
npx vp test runinpackages/mcp: 69 files, 1014 tests pass. New tests cover add-only writes, unchanged calls, the removal preview and token, stale previews, shipment tags with reference numbers, unreadable lists, 422 noop, and input validation.🤖 Generated with Claude Code
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.The PR appears safe to merge, with non-blocking feedback to restore read-back failure tests.
Fix with agent prompt
Summary
Replaces the two reference-number tools with
update_recordin the defaultoperationstoolset.update_record.Diagram
%%{init: {'theme': 'neutral'}}%% flowchart TD A[update_record] --> B[Read requested lists] B --> C{Lists readable?} C -->|No| D[Return unreadable_list] C -->|Yes| E{Any change?} E -->|No| F[Return unchanged] E -->|Yes| G{Removes a stored value?} G -->|No| J[PATCH merged lists] G -->|Yes| H[Show preview and ask for approval] H --> I[Check approval and current lists] I -->|Valid and unchanged| J I -->|Changed| H J --> K[Read lists back and report result]Reviews (1) · Last reviewed commit: "feat(mcp): replace the reference number ..." · Reviewed by Greptile